package com.homegoods.videomodule.ui.view;

import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.widget.ImageView;

import cn.jzvd.JZDataSource;
import cn.jzvd.JzvdStd;

/**
 * @author QiQi
 * @ClassName: LiveShowVideo
 * @date 2018/10/26
 * @description
 */
public class LiveShowVideo extends JzvdStd {
    public LiveShowVideo(Context context) {
        super(context);
    }

    public LiveShowVideo(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void init(Context context) {
        super.init(context);
        thumbImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        ViewCompat.setTransitionName(thumbImageView, "image");
        textureViewContainer.setOnClickListener(null);
        textureViewContainer.setOnTouchListener(null);
    }

    @Override
    public void setUp(JZDataSource jzDataSource, int screen) {
        jzDataSource.looping = true;
        super.setUp(jzDataSource, screen);
    }

    @Override
    public void setAllControlsVisiblity(int topCon, int bottomCon, int startBtn, int loadingPro, int thumbImg, int bottomPro, int retryLayout) {
        super.setAllControlsVisiblity(INVISIBLE, INVISIBLE, INVISIBLE, INVISIBLE, thumbImg, INVISIBLE, INVISIBLE);
    }

    /**
     * 直接开始播放
     */
    public void directPlay() {
        startButton.performClick();
    }
}
